<%@ page import="com.wuming.house.security.SecurityHander" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html>
<head>
    <meta charset="utf-8">
    <title>同步122数据</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${allServerPath}static/layui/layui/css/layui.css" media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body style="background-color: #f0f2f5;">
<div style="padding: 15px;margin: 15px;background-color: #fff;">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>同步122数据</legend>
    </fieldset>
    <form class="layui-form" id="editUser">
        <div class="layui-row">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">开始时间</label>

                    <div class="layui-input-inline">
                        <input type="text" name="startTime" id="startTime" value=""
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">结束时间</label>

                    <div class="layui-input-inline">
                        <input type="text" name="endTime" id="endTime" value=""
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <button class="layui-btn layui-btn-normal" type="button" name="btnSave" id="syncStudent">同步学员</button>
        </div>
        <input type="hidden" name="id" value="${member['id']}"/>
    </form>
</div>

<script src="${allServerPath}static/layui/layui/layui.js"></script>
<script>
    layui.use(['form', 'jquery', 'laydate'], function () {
        var form = layui.form
                , layer = layui.layer
                , laydate = layui.laydate
                , $ = layui.jquery;

        laydate.render({
            elem: '#startTime'
        });

        laydate.render({
            elem: '#endTime'
        });

        $("#syncStudent").click(function () {
            $.ajax({
                type: "post",
                url: "${allServerPath}/web/data/syncStudent.htmls",
                data: {
                    memberId: <%=SecurityHander.getCurrentUserId()%>,
                    startTime: $("input[name='startTime']").val(),
                    endTime: $("input[name='endTime']").val()
                },
                dataType: "JSON",
                success: function (data) {
                    if (data.success) {
                        layer.msg("同步成功.");
                    }
                },
                error: function (msg) {
                    layer.msg("同步失败.");
                }
            });
        });
    });
</script>
</body>
</html>
